const express = require('express')
const app = express()
const bodyParser = require('body-parser')
const logService = require('../service/log')
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({ extended: false }))

// 查询所有（分页查询）
app.post('/api/log/list', (req, res) => {
  logService.getLogList(req.body).then(data => {
    res.json({ code: 200, data: { 'records': data.rows, 'total': data.count }})
  })
    .catch(err => {
      res.json({ code: 500, userMsg: '服务器异常'})
      console.log(err)
    })
})


module.exports = app
